//Initializes a ne
w instance of the POP3 class.
POP3 objPOP3 =
new
POP3(
"mail.server.com"
,
"username@server.com"
,
"password"
);
//Connects to POP3 server.
if
(!objPOP3.Connect()) { Console.WriteLine(objPOP3.LastError);
return;
}
//Check i
f server supports secure authentication.
if
(objPOP3.IsAPOPSupported)
Console.WriteLine(objPOP3.SecureLogin() ?
"Secure Logged in"
:
"Can't login"
);
else
Console.WriteLine(objPOP3.Login() ?
"Logged in"
:
"Can't login"
);
//Gets stat information from server (number of messages and inbox size).
objPOP3.QueryServer();
//Number of emails fo
r the email account.
Console.WriteLine(
"Emails count: "
+ objPOP3.TotalMailCount);
//The size of the Inbox in bytes.
Console.WriteLine(
"Emails count: "
+ objPOP3.TotalMailCount);
//Close the POP3 Connection.
objPOP3.Close();